/*   1:    */ package org.intellij.images.editor.impl;
/*   2:    */ 
/*   3:    */

import com.intellij.codeHighlighting.BackgroundEditorHighlighter;
import com.intellij.ide.structureView.StructureViewBuilder;
import com.intellij.openapi.fileEditor.FileEditorLocation;
import com.intellij.openapi.fileEditor.FileEditorState;
import com.intellij.openapi.fileEditor.FileEditorStateLevel;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import org.intellij.images.editor.ImageEditor;
import org.intellij.images.editor.ImageFileEditor;
import org.intellij.images.editor.ImageZoomModel;
import org.intellij.images.options.*;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.beans.PropertyChangeListener;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */
/*  10:    */
/*  11:    */
/*  12:    */
/*  13:    */
/*  14:    */
/*  15:    */
/*  16:    */
/*  17:    */
/*  18:    */
/*  19:    */
/*  20:    */
/*  21:    */
/*  22:    */
/*  23:    */
/*  24:    */ 
/*  25:    */ final class ImageFileEditorImpl
/*  26:    */   extends UserDataHolderBase
/*  27:    */   implements ImageFileEditor
/*  28:    */ {
/*  29:    */   @NonNls
/*  30:    */   private static final String a = "ImageFileEditor";
/*  31:    */   private final ImageEditor b;
/*  32:    */   
/*  33:    */   ImageFileEditorImpl(@NotNull Project paramProject, @NotNull VirtualFile paramVirtualFile)
/*  34:    */   {
/*  35: 48 */     this.b = ImageEditorManagerImpl.createImageEditor(paramProject, paramVirtualFile);
/*  36:    */     
/*  37:    */ 
/*  38: 51 */     VirtualFileManager.getInstance().addVirtualFileListener(this.b);
/*  39:    */     
/*  40:    */ 
/*  41: 54 */     Options localOptions = OptionsManager.getInstance().getOptions();
/*  42: 55 */     EditorOptions localEditorOptions = localOptions.getEditorOptions();
/*  43: 56 */     GridOptions localGridOptions = localEditorOptions.getGridOptions();
/*  44: 57 */     TransparencyChessboardOptions localTransparencyChessboardOptions = localEditorOptions.getTransparencyChessboardOptions();
/*  45: 58 */     this.b.setGridVisible(localGridOptions.isShowDefault());
/*  46: 59 */     this.b.setTransparencyChessboardVisible(localTransparencyChessboardOptions.isShowDefault());
/*  47:    */   }
/*  48:    */   
/*  49:    */   @NotNull
/*  50:    */   public JComponent getComponent()
/*  51:    */   {
/*  52: 64 */     JComponent tmp9_4 = this.b.getComponent();
/*  53: 64 */     if (tmp9_4 == null) {
/*  54: 64 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/images/editor/impl/ImageFileEditorImpl", "getComponent" }));
/*  55:    */     }
/*  56: 64 */     return tmp9_4;
/*  57:    */   }
/*  58:    */   
/*  59:    */   public JComponent getPreferredFocusedComponent()
/*  60:    */   {
/*  61: 68 */     return this.b.getContentComponent();
/*  62:    */   }
/*  63:    */   
/*  64:    */   @NotNull
/*  65:    */   public String getName()
/*  66:    */   {
/*  67: 73 */     String tmp2_0 = "ImageFileEditor";
/*  68: 73 */     if (tmp2_0 == null) {
/*  69: 73 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/images/editor/impl/ImageFileEditorImpl", "getName" }));
/*  70:    */     }
/*  71: 73 */     return tmp2_0;
/*  72:    */   }
/*  73:    */   
/*  74:    */   @NotNull
/*  75:    */   public FileEditorState getState(@NotNull FileEditorStateLevel paramFileEditorStateLevel)
/*  76:    */   {
/*  77: 78 */     if (paramFileEditorStateLevel == null) {
/*  78: 78 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/images/editor/impl/ImageFileEditorImpl", "getState" }));
/*  79:    */     }
/*  80: 78 */     ImageZoomModel localImageZoomModel = this.b.getZoomModel(); void 
/*  81: 79 */       tmp81_78 = new ImageFileEditorState(this.b.isTransparencyChessboardVisible(), this.b.isGridVisible(), localImageZoomModel.getZoomFactor());
/*  82: 79 */     if (tmp81_78 == null) {
/*  83: 79 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/images/editor/impl/ImageFileEditorImpl", "getState" }));
/*  84:    */     }
/*  85: 79 */     return tmp81_78;
/*  86:    */   }
/*  87:    */   
/*  88:    */   public void setState(@NotNull FileEditorState paramFileEditorState)
/*  89:    */   {
/*  90: 86 */     if (paramFileEditorState == null) {
/*  91: 86 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/images/editor/impl/ImageFileEditorImpl", "setState" }));
/*  92:    */     }
/*  93: 86 */     if ((paramFileEditorState instanceof ImageFileEditorState))
/*  94:    */     {
/*  95: 87 */       ImageFileEditorState localImageFileEditorState = (ImageFileEditorState)paramFileEditorState;
/*  96: 88 */       ImageZoomModel localImageZoomModel = this.b.getZoomModel();
/*  97: 89 */       this.b.setTransparencyChessboardVisible(localImageFileEditorState.isBackgroundVisible());
/*  98: 90 */       this.b.setGridVisible(localImageFileEditorState.isGridVisible());
/*  99: 91 */       localImageZoomModel.setZoomFactor(localImageFileEditorState.getZoomFactor());
/* 100:    */     }
/* 101:    */   }
/* 102:    */   
/* 103:    */   public boolean isModified()
/* 104:    */   {
/* 105: 96 */     return false;
/* 106:    */   }
/* 107:    */   
/* 108:    */   public boolean isValid()
/* 109:    */   {
/* 110:100 */     return true;
/* 111:    */   }
/* 112:    */   
/* 113:    */   public void selectNotify() {}
/* 114:    */   
/* 115:    */   public void deselectNotify() {}
/* 116:    */   
/* 117:    */   public void addPropertyChangeListener(@NotNull PropertyChangeListener paramPropertyChangeListener)
/* 118:    */   {
/* 119:110 */     if (paramPropertyChangeListener == null) {
/* 120:110 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/images/editor/impl/ImageFileEditorImpl", "addPropertyChangeListener" }));
/* 121:    */     }
/* 122:    */   }
/* 123:    */   
/* 124:    */   public void removePropertyChangeListener(@NotNull PropertyChangeListener paramPropertyChangeListener)
/* 125:    */   {
/* 126:113 */     if (paramPropertyChangeListener == null) {
/* 127:113 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/images/editor/impl/ImageFileEditorImpl", "removePropertyChangeListener" }));
/* 128:    */     }
/* 129:    */   }
/* 130:    */   
/* 131:    */   public BackgroundEditorHighlighter getBackgroundHighlighter()
/* 132:    */   {
/* 133:116 */     return null;
/* 134:    */   }
/* 135:    */   
/* 136:    */   public FileEditorLocation getCurrentLocation()
/* 137:    */   {
/* 138:120 */     return null;
/* 139:    */   }
/* 140:    */   
/* 141:    */   public StructureViewBuilder getStructureViewBuilder()
/* 142:    */   {
/* 143:124 */     return null;
/* 144:    */   }
/* 145:    */   
/* 146:    */   public void dispose()
/* 147:    */   {
/* 148:128 */     VirtualFileManager.getInstance().removeVirtualFileListener(this.b);
/* 149:129 */     ImageEditorManagerImpl.releaseImageEditor(this.b);
/* 150:    */   }
/* 151:    */   
/* 152:    */   @NotNull
/* 153:    */   public ImageEditor getImageEditor()
/* 154:    */   {
/* 155:134 */     ImageEditor tmp4_1 = this.b;
/* 156:134 */     if (tmp4_1 == null) {
/* 157:134 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/images/editor/impl/ImageFileEditorImpl", "getImageEditor" }));
/* 158:    */     }
/* 159:134 */     return tmp4_1;
/* 160:    */   }
/* 161:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.images.editor.impl.ImageFileEditorImpl

 * JD-Core Version:    0.7.0.1

 */